package com.fanqwz.kotlinmvvm.presenter.viewmodel

import android.arch.lifecycle.ViewModel
import com.fanqwz.kotlinmvvm.common.util.log.MyLogger
import javax.inject.Inject

/**
 * Created by fanqwz on 2017/10/11.
 */

interface IViewModel<T : IModel> {
    fun <VM> bind(): VM
}

abstract class BaseViewModel<T : IModel> : ViewModel(), IViewModel<T> {
    @Inject
    lateinit var logger: MyLogger

    override fun <VM> bind(): VM {
        @Suppress("UNCHECKED_CAST")
        return this as VM/*这里有一个神奇的强制类型转换，be careful*/
    }
}
